package com.lyc.user.service.impl;

import com.lyc.user.dao.UserMapper;
import com.lyc.user.entity.User;
import com.lyc.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User findByUsername(String username) {
        return userMapper.selectByUsername(username);
    }

//    @Override
//    @Transactional
//    public void addUser(User user) {
//        userMapper.insertSelective(user);
//        //测试事务回滚
////        int i =1/0;
//        userMapper.insertSelective(user);
//    }
}
